package wqh.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import wqh.dao.GeoLocationDao;
import wqh.domain.GeoLocation;
import wqh.service.GeoLocationService;

import java.util.List;

/**
 * Created by devts on 2017/1/3.
 */
@Service("geoLocationService")
public class GeoLocationServiceImpl implements GeoLocationService {

    private final GeoLocationDao geoLocationDao;

    @Autowired
    public GeoLocationServiceImpl(GeoLocationDao geoLocationDao) {
        this.geoLocationDao = geoLocationDao;
    }

    public void save(GeoLocation entity) {
        this.geoLocationDao.save(entity);
    }

    public void update(GeoLocation entity) {
        this.geoLocationDao.update(entity);
    }

    public void delete(GeoLocation entity) {
        this.geoLocationDao.delete(entity);
    }

    public void deleteAll() {
        this.geoLocationDao.deleteAll();
    }

    public List<GeoLocation> findAll() {
        return this.geoLocationDao.findAll();
    }

    public GeoLocation findById(Long id) {
        return this.geoLocationDao.findById(id);
    }

    public int findMaxLevel() {
        return this.geoLocationDao.findMaxLevel();
    }

    public List<GeoLocation> findByParentID(Long parent_id) {
        return this.geoLocationDao.findByParentID(parent_id);
    }

    public void deleteByParentIdAndLevel(Long parent_id, Integer level) {
        this.geoLocationDao.deleteByParentIdAndLevel(parent_id, level);
    }
}
